package cn.com.api.mapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.com.api.entity.ApiT_browse_history;
import cn.com.api.entity.ApiT_member;
import cn.com.util.*;

//DAO
public interface ApiT_browse_historyMapper {

	// 根据id查看
	@Select("SELECT * FROM t_browse_history WHERE bid = #{bid}")
	public ApiT_browse_history findT_browse_historyById(Integer bid);

	// 查看数据集
	@Select("SELECT * FROM t_browse_history")
	public List<ApiT_browse_history> findT_browse_historys();

	// 添加
	@Insert("INSERT INTO t_browse_history (goodid, uid, adddate) VALUES (#{goodid}, #{uid},  #{adddate})")
	@Options(useGeneratedKeys = true, keyProperty = "bid")
	public int insertT_browse_history(ApiT_browse_history apiT_browse_history);

	// 修改
	@Update("UPDATE t_browse_history SET goodid = #{goodid}, uid = #{uid}, adddate = #{adddate} WHERE bid = #{bid}")
	public int updateT_browse_history(ApiT_browse_history apiT_browse_history);

	// 删除
	@Delete("DELETE FROM t_browse_history  WHERE bid = #{bid}")
	public int deleteT_browse_history(Integer bid);

	// 查看数据集
	public List<ApiT_browse_history> findT_browse_historysListPage(@Param("map") HashMap map,
			@Param("page") PageInfo page);

	// 查看数据集
	public List<Map<String, Object>> findBrowseHostoryGoods(@Param("uid") String uid);

	// 获取某一天访问某个店铺的人数
	public Integer getSumBrowsePerson(@Param("shopid") String shopid, @Param("nowDate") String date);

}
